﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace VirtualPress.Infrastructure.Entities.Repository
{
    [Table("C_ConferenceMapping")]
    public class C_ConferenceMapping : IEntity<C_ConferenceMapping>
    {
        [Column(TypeName="varchar")]
        [StringLength(128)]
        [Key]
        public string Host{get;set;}

        public int ConferenceId { get; set; }

        public override C_ConferenceMapping Find(string key)
        {
            return Find(c => c.Host == key);
        }

        public override C_ConferenceMapping Find(System.Linq.Expressions.Expression<Func<C_ConferenceMapping, bool>> where)
        {
            using (Context ctx = new Context())
            {
                return ctx.ConferenceMapping.FirstOrDefault(where);
            }
        }

        public override bool Any(System.Linq.Expressions.Expression<Func<C_ConferenceMapping, bool>> where)
        {
            using (Context ctx = new Context())
            {
                return ctx.ConferenceMapping.Any(where);
            }
        }
    }
}
